"""
通用 Schemas
"""
from pydantic import BaseModel
from typing import Generic, TypeVar, List, Optional

T = TypeVar('T')


class ApiResponse(BaseModel, Generic[T]):
    """通用API响应"""
    code: int = 200
    message: str = "success"
    data: Optional[T] = None


class PageData(BaseModel, Generic[T]):
    """分页数据"""
    list: List[T]
    total: int
    page: int
    pageSize: int
    hasMore: bool


class SuccessResponse(BaseModel):
    """成功响应"""
    message: str = "操作成功"


class Location(BaseModel):
    """位置信息"""
    latitude: float
    longitude: float
    address: str
    distance: Optional[float] = None

